package cn.anecansaitin.firecrafting.common.net;

import cn.anecansaitin.firecrafting.ModConstant;
import cn.anecansaitin.firecrafting.common.net.pack.ScreenButtonPressedToBlock;
import cn.anecansaitin.firecrafting.common.net.pack.ScreenButtonPressedToMenu;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.network.NetworkRegistry;
import net.minecraftforge.network.simple.SimpleChannel;

public class ModNetwork {
    public static final String NETWORK_VER = "1";
    public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel(new ResourceLocation(ModConstant.MOD_ID, "channel_1"), () -> NETWORK_VER, NETWORK_VER::equals, NETWORK_VER::equals);

    public static void registry() {
        int id = 0;
        CHANNEL.registerMessage(id++, ScreenButtonPressedToMenu.class, ScreenButtonPressedToMenu::encode, ScreenButtonPressedToMenu::decode, ScreenButtonPressedToMenu::handle);
        CHANNEL.registerMessage(id++, ScreenButtonPressedToBlock.class, ScreenButtonPressedToBlock::encode, ScreenButtonPressedToBlock::decode, ScreenButtonPressedToBlock::handle);
    }
}